package com.sprboot.demo.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.github.pagehelper.PageInfo;
import com.oms.vo.first.User;

@RestController
public class RibbonConsumerController {
	
	@Autowired
	private RestTemplate rest;

	@GetMapping("/ribbon/test")
	public String consumer() {
		System.out.println("coming......");
		String url="http://oms-web/demo/test";
		String res=rest.getForObject(url, String.class);
		return res;
	}
	@PostMapping("/us")
	public PageInfo<User>  getUser(@RequestBody Map<String,Integer> map){
		String url="http://oms-web/mybatis/us";
		PageInfo<User> res=rest.postForObject(url, map, PageInfo.class);
		
		return res;
	}
}
